// const sendSms = (String phone) {

// };

import 'package:dio/dio.dart';
import 'package:rxdart/rxdart.dart';
import 'package:wanchong/bean/login_entity.dart';
import 'package:wanchong/bean/send_sms_response_entity.dart';
import 'package:wanchong/bean/success.dart';
import 'package:wanchong/bean/success_entity.dart';
import 'package:wanchong/bean/user_info_entity.dart';
import 'package:wanchong/utils/http.dart';
import 'package:wanchong/bean/login_go_entity.dart';
import 'package:wanchong/bean/set_password_entity.dart';
// Future<String> register(params) async{ 
//   // List<Invitation> invitations = List<Invitation>();
//   await Http.getInstance().post('/v1/register', params: params);
// }
// ///发送短信
// Future<String> sendSms(String phone) async {
//   await Http.getInstance().get('/v1/sms',params: FormData.from({
//     "phone":phone
//   }));
// }
//发送短信验证码
PublishSubject<SendSmsResponseEntity> sendSms<BaseResponse>(String phone) {
  return Http.getInstance().get<SendSmsResponseEntity>("/v1/sms",
      params: FormData.from({"phone": phone}));
}
 
//短信验证
PublishSubject<LoginEntity> smsLogin<BaseResponse>(
    String code, String account) {
  return Http.getInstance().post<LoginEntity>("/v1/register",
      params: FormData.from(
          {"code": code, "account": account, "type": "sms", "psw": ""}));
}

//密码登录
PublishSubject<LoginEntity> pswLogin<BaseResponse>(String account, String psw) {
  return Http.getInstance().post<LoginEntity>("/v1/register",
      params: FormData.from({"account": account, "type": "psw", "psw": psw}));
}

//设置密码
PublishSubject<SetPasswordEntity> pswSoin<BaseResponse>(String rpsw, String psw) {
  print('============254654========');
  return Http.getInstance().post<SetPasswordEntity>("/v1/psw_callback",
      params: FormData.from({"rpsw": psw, "psw": psw}));
}

//个人信息添加
PublishSubject<SetPasswordEntity> updateMean<BaseResponse>(
    String header, String nick, int sex, int birthday, String city) {
  return Http.getInstance().post<SetPasswordEntity>("/v1/update_mean",
      params: FormData.from({
        'header': header,
        'nick': nick,
        'sex': sex,
        'birthday': birthday,
        'city': city,
      }));
}

PublishSubject<UserInfoEntity> userInfo<BaseResponse>() {
  return Http.getInstance().get<UserInfoEntity>("v1/account");
}

PublishSubject<SuccessEntity> saveUser<BaseResponse>(FormData data) {
  return Http.getInstance().post<SuccessEntity>("v1/update_mean",params: data);
}